package net.lab1024.sa.admin.module.yitihua.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119CompoundAddForm;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119CompoundQueryForm;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119CompoundUpdateForm;
import net.lab1024.sa.admin.module.yitihua.domain.vo.Cfs119CompoundVO;
import net.lab1024.sa.admin.module.yitihua.service.Cfs119CompoundService;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 一体化平台小区信息 Controller
 *
 * @Author cfsjiazy
 * @Date 2025-09-12 14:11:04
 * @Copyright  
 */

@RestController
@Tag(name = "一体化平台小区信息")
public class Cfs119CompoundController {

    @Resource
    private Cfs119CompoundService cfs119CompoundService;

    @Operation(summary = "分页查询 @author cfsjiazy")
    @PostMapping("/cfs119Compound/queryPage")
    @SaCheckPermission("cfs119Compound:query")
    public ResponseDTO<PageResult<Cfs119CompoundVO>> queryPage(@RequestBody @Valid Cfs119CompoundQueryForm queryForm) {
        return ResponseDTO.ok(cfs119CompoundService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author cfsjiazy")
    @PostMapping("/cfs119Compound/add")
    @SaCheckPermission("cfs119Compound:add")
    public ResponseDTO<String> add(@RequestBody @Valid Cfs119CompoundAddForm addForm) {
        return cfs119CompoundService.add(addForm);
    }

    @Operation(summary = "更新 @author cfsjiazy")
    @PostMapping("/cfs119Compound/update")
    @SaCheckPermission("cfs119Compound:update")
    public ResponseDTO<String> update(@RequestBody @Valid Cfs119CompoundUpdateForm updateForm) {
        return cfs119CompoundService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author cfsjiazy")
    @PostMapping("/cfs119Compound/batchDelete")
    @SaCheckPermission("cfs119Compound:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<String> idList) {
        return cfs119CompoundService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author cfsjiazy")
    @GetMapping("/cfs119Compound/delete/{id}")
    @SaCheckPermission("cfs119Compound:delete")
    public ResponseDTO<String> batchDelete(@PathVariable String id) {
        return cfs119CompoundService.delete(id);
    }

    @Operation(summary = "根据小区id查询 @author cfsjiazy")
    @GetMapping("/cfs119Compound/queryByCommunityId/{communityId}")
    @SaCheckPermission("cfs119Compound:query")
    public ResponseDTO<List<Cfs119CompoundVO>> queryByCommunityId(@PathVariable String communityId) {
        return ResponseDTO.ok(cfs119CompoundService.queryByCommunityId(communityId));
    }
}
